<%@ page language="java" import="java.util.*" pageEncoding="utf-8"
	isELIgnored="false"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
    String path = request.getContextPath();
			String basePath = request.getScheme() + "://"
					+ request.getServerName() + ":" + request.getServerPort()
					+ path + "/";
%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="<%=request.getContextPath()%>/css/style.css" rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath()%>/css/select.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.idTabs.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/select-ui.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/editor/kindeditor.js"></script>

<script type="text/javascript">
    KE.show({
        id : 'content7',
        cssPath : './index.css'
    });
  </script>
  
<script type="text/javascript">
$(document).ready(function(e){
    $(".select1").uedSelect({
		width : 345			  
	});
	$(".select2").uedSelect({
		width : 167  
	});
	$(".select3").uedSelect({
		width : 100
	});
});
</script>
<style type="text/css">
	label{
		font-size:13;
	}
</style>
</head>

<body>

	<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><e>首页</e></li>
    <li><e>用户管理</e></li>
    <li><e>积分设置</e></li>
    </ul>
    </div>
    
    <div class="formbody">
    
    
    <div id="usual1" class="usual"> 
    
    <div class="itab">
  	<ul> 
    <li><a href="#tab1" class="selected" style="font-size:15">积分设置</a></li> 
    
  	</ul>
    </div> 
    
  	<div id="tab1" class="tabson">
    <c:forEach items="${lists}" var="data">
    <ul class="forminfo">
    <li><label style="width:160px;">普通会员交易金额1元获得:</label><input name="common_vip" type="text" class="dfinput" value="${data.common_vip}" style="width:40px;"/>积分</li>
    <li><label style="width:160px;">铜牌会员交易金额1元获得:</label><input name="copper_vip" type="text" class="dfinput" value="${data.copper_vip}" style="width:40px;"/>积分</li>
    <li><label style="width:160px;">银牌会员交易金额1元获得:</label><input name="silver_vip" type="text" class="dfinput" value="${data.silver_vip}" style="width:40px;"/>积分</li>
    <li><label style="width:160px;">金牌会员交易金额1元获得:</label><input name="gold_vip" type="text" class="dfinput" value="${data.gold_vip}" style="width:40px;"/>积分</li>
<%--     <li><label style="width:160px;">用户支付1元推荐用户获得:</label><input name="recommend_integral" type="text" class="dfinput" value="${data.recommend_integral}" style="width:40px;"/>积分</li>
 --%>    <li><label style="width:160px;">用户服务一次获得:</label><input name="server" type="text" class="dfinput" value="${data.server}" style="width:40px;"/>积分</li>
    <li><label style="width:160px;">五星好评获得:</label><input name="five_star" type="text" class="dfinput" value="${data.five_star}" style="width:40px;"/>积分</li>
    <li><label style="width:160px;">二星差评扣除:</label><input name="tow_star" type="text" class="dfinput" value="${data.tow_star}" style="width:40px;"/>积分</li>
    <li><label style="width:160px;">积分抵现1积分抵:</label><input name="Integral_arrival" type="text" class="dfinput" value="${data.Integral_arrival}" style="width:40px;"/>元</li>
<%--     <li><label style="width:160px;">VIP用户消费折扣:</label><input name="vip_server_discount" type="text" class="dfinput" value="${data.vip_server_discount}" style="width:40px;"/>%</li>
 --%>    </ul>
    </c:forEach>
    <div style="margin-left:80px;"><input name="" type="button" class="tijiao" value="提交" style="width:96px; height:35px; line-height:35px; color:#fff; background:red; font-size:14px; font-weight:bold;border-radius: 3px; cursor:pointer;"/>
    </div> 
  </div>
  <script type="text/javascript">
  	$(function(){
  		var common_vip = $("input[name=common_vip]").val();
  		var copper_vip = $("input[name=copper_vip]").val();
  		var silver_vip = $("input[name=silver_vip]").val();
  		var gold_vip = $("input[name=gold_vip]").val();
  		var recommend_integral = $("input[name=recommend_integral]").val();
  		var server = $("input[name=server]").val();
  		var five_star = $("input[name=five_star]").val();
  		var tow_star = $("input[name=tow_star]").val();
  		var Integral_arrival = $("input[name=Integral_arrival]").val();
  		var vip_server_discount = $("input[name=vip_server_discount]").val();
  		$("input[name=common_vip]").blur(function(){
  			if(!/^\d+$/.test($(this).val())){ 
  				alert("请输入正整数");
  				$("input[name=common_vip]").val(common_vip);return;
  			}
        });
  		$("input[name=copper_vip]").blur(function(){
  			if(!/^\d+$/.test($(this).val())){ 
  				alert("请输入正整数");
  				$("input[name=copper_vip]").val(copper_vip);return;
  			}
        });
  		$("input[name=silver_vip]").blur(function(){
  			if(!/^\d+$/.test($(this).val())){ 
  				alert("请输入正整数");
  				$("input[name=silver_vip]").val(silver_vip);return;
  			}
        });
  		$("input[name=gold_vip]").blur(function(){
  			if(!/^\d+$/.test($(this).val())){ 
  				alert("请输入正整数");
  				$("input[name=gold_vip]").val(gold_vip);return;
  			}
        });
  		$("input[name=recommend_integral]").blur(function(){
  			if(!/^\d+$/.test($(this).val())){ 
  				alert("请输入正整数");
  				$("input[name=recommend_integral]").val(recommend_integral);return;
  			}
        });
  		$("input[name=server]").blur(function(){
  			if(!/^\d+$/.test($(this).val())){ 
  				alert("请输入正整数");
  				$("input[name=server]").val(server);return;
  			}
        });
  		$("input[name=five_star]").blur(function(){
  			if(!/^\d+$/.test($(this).val())){ 
  				alert("请输入正整数");
  				$("input[name=five_star]").val(five_star);return;
  			}
        });
  		$("input[name=tow_star]").blur(function(){
  			if(!/^\d+$/.test($(this).val())){ 
  				alert("请输入正整数");
  				$("input[name=tow_star]").val(tow_star);return;
  			}
        });
  		$("input[name=Integral_arrival]").blur(function(){
        	if(isNaN($(this).val())){
      	    	 alert("请输入数字！");$("input[name=Integral_arrival]").val(Integral_arrival);return;
      	    }
        });
  		$("input[name=vip_server_discount]").blur(function(){
  			if(!/^\d+$/.test($(this).val())){ 
  				alert("请输入正整数");
  				$("input[name=vip_server_discount]").val(vip_server_discount);return;
  			}
        });
  		
  		$(".tijiao").click(function(){
  			$.ajax({
  				type:"get",
  				url:"/htx-backer/integralSet", 
  				data:{
  					common_vip:$("input[name=common_vip]").val(),
  					copper_vip:$("input[name=copper_vip]").val(),
  					silver_vip:$("input[name=silver_vip]").val(),
  					gold_vip:$("input[name=gold_vip]").val(),
  					recommend_integral:$("input[name=recommend_integral]").val(),
  					server:$("input[name=server]").val(),
  					five_star:$("input[name=five_star]").val(),
  					tow_star:$("input[name=tow_star]").val(),
  					Integral_arrival:$("input[name=Integral_arrival]").val(),
  					vip_server_discount:$("input[name=vip_server_discount]").val(),
  				},
  				dataType:"json",
  				success:function(data){
  					if(data.flag > 0){
  					 	var btn = confirm("提交成功,点击确定返回积分设置!")
  					 	if(btn == true){
		   					window.location.href="/htx-backer/selectIntegral";
  					 	}
  					}
  				}
			}) 
  		})
  	})
  </script>
</body>
</html>
